package com.cnap.multiclouldmgmt.service;

import com.cnap.multiclouldmgmt.model.privatecloud.PrivateVmCreateModel;
import com.cnap.multiclouldmgmt.model.vm.VmCreateModel;
import com.cnap.multiclouldmgmt.model.vm.VmModel;

import java.util.List;
/**
 * @author dyq
 * 基础服务
 */
public interface VmResourceService {

    void updateK8sClusterUseQuota(String k8sclusterName,String usrName,String handler,int k8sChangeNum);

    boolean checkUserK8sClusterQuota(String usrName);

    /**
     *
     * @param vmCreateModel 资源的需求
     */
    void createVmResource(VmCreateModel vmCreateModel);

    /**
     *
     * @param cloudVendors
     * @param k8sClusterName
     * @param nodeName
     * @param osImage
     * @param cpuNum
     * @param memNum
     * @param appType
     * @throws Exception
     */
    void addNewResource(String cloudVendors,String k8sClusterName,String nodeName,String osImage,int cpuNum,int memNum,String appType) throws Exception;

    /**
     *
     * @param cloudVendors
     * @param k8sClusterName
     * @param nodeNum
     * @param osImage
     * @param cpuNum
     * @param memNum
     * @param appType
     * @throws Exception
     */
    void addNewResource(String cloudVendors,String k8sClusterName,int nodeNum,String osImage,int cpuNum,int memNum,String appType) throws Exception;

    /**
     *
     * @param cloudVendors
     * @param k8sClusterName
     * @param appType
     * @param delPolicy
     * @param delNodeNum
     */
    boolean delResource(String cloudVendors,String k8sClusterName,String appType,String delPolicy,int delNodeNum);

    /**
     *
     * @param cloudVendors
     * @param k8sClusterName
     * @param cpuUsage
     * @param memUsage
     * @throws Exception
     */
    int addNewResourceForScale(String cloudVendors, String k8sClusterName, int cpuUsage,int memUsage,String appType);

    /**
     *
     * @param vmCreateModel
     */
    void handleVmCreateInfo(VmCreateModel vmCreateModel);

    /**
     * 结束整个流程
     * @param vmCreateModel
     */
    void endVmCreateInfo(VmCreateModel vmCreateModel);

    /**
     * 删除资源
     * @param vmModels
     */
    void delVms(List<VmModel> vmModels);

    /**
     *
     * @param vmCreateModel
     */
    public void handleEmptyVmModels(VmCreateModel vmCreateModel) throws Exception;

    /**
     *
     * @param vmCreateModel
     */
    public void handleVmModels(VmCreateModel vmCreateModel);

    /**
     * 创建send
     * @param vmSendCreateModel
     * @param vmCreateModel
     */
    void initVmSendCreateModel(VmCreateModel vmSendCreateModel, VmCreateModel vmCreateModel);

    /**
     * 创建send
     * @param vmSendCreateModel
     */
    void updateStageMsg(VmCreateModel vmSendCreateModel);

    /**
     * 删除服务
     * @param svcId
     * @param type
     */
    void delSvcToVmCreate(String svcId, String type) throws Exception;

    /**
     * 因为删除微服务，去掉整个vm的进行的流程
     * @param svcId
     */
    void removeCreateVmProcess(String svcId);

    /**
     * 已经建好的虚机进行
     * @param privateVmCreateModel
     */
    void addVmK8sCluster(PrivateVmCreateModel privateVmCreateModel);
}
